<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Move the cursor in the result</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.cubrid-move-cursor" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">cubrid_move_cursor</h1>
  <p class="verinfo">(PECL CUBRID &gt;= 8.3.0)</p><p class="refpurpose"><span class="refname">cubrid_move_cursor</span> &mdash; <span class="dc-title">Move the cursor in the result</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.cubrid-move-cursor-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>cubrid_move_cursor</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$req_identifier</code></span>  
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$offset</code></span>  
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$origin</code><span class="initializer"> = CUBRID_CURSOR_CURRENT</span></span>  
  ] ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
    The <span class="function"><strong>cubrid_move_cursor()</strong></span> function is used to move the
    current cursor location of <code class="parameter">req_identifier</code> by the
    value set in the <code class="parameter">offset</code> argument, to the direction
    set in the <code class="parameter">origin</code> argument. To set the
    <code class="parameter">origin</code> argument, you can use CUBRID_CURSOR_FIRST
    for the first part of the result, CUBRID_CURSOR_CURRENT for the current
    location of the result, or CUBRID_CURSOR_LAST for the last part of the
    result.  If <code class="parameter">origin</code> argument is not explicitly
    designated, then the function uses CUBRID_CURSOR_CURRENT as its default
    value.
  </p>
  <p class="para">
    If the value of cursor movement range goes over the valid limit, then the
    cursor moves to the next location after the valid range for the cursor.
    For example, if you move 20 units in the result with the size of 10, then
    the cursor will move to 11th place and return CUBRID_NO_MORE_DATA.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.cubrid-move-cursor-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
  <dl>

    
  <dt>
<code class="parameter">req_identifier</code></dt>

  <dd>
<p class="para">Request identifier.</p></dd>

   
   
  <dt>
<code class="parameter">offset</code></dt>

  <dd>
<p class="para">Number of units you want to move the cursor.</p></dd>

   
  
  <dt>
<code class="parameter">origin</code></dt>

  <dd>
<p class="para">Location where you want to move the cursor from CUBRID_CURSOR_FIRST, CUBRID_CURSOR_CURRENT, CUBRID_CURSOR_LAST.</p></dd>

   
  </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.cubrid-move-cursor-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   <strong><code>TRUE</code></strong>, when process is successful.
  </p>
  <p class="para">
   <strong><code>FALSE</code></strong>, when process is unsucceful.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.cubrid-move-cursor-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-1135">
   <p><strong>Example #1 <span class="function"><strong>cubrid_move_cursor()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$conn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"127.0.0.1"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">33000</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"demodb"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"dba"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$req&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;code"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">cubrid_move_cursor</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">CUBRID_CURSOR_LAST</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_fetch_row</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cubrid_move_cursor</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">CUBRID_CURSOR_FIRST</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_fetch_row</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cubrid_move_cursor</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">CUBRID_CURSOR_CURRENT</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_fetch_row</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cubrid_close_request</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">cubrid_disconnect</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
   </div>

<div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
array(2) {
  [0]=&gt;
  string(1) &quot;G&quot;
  [1]=&gt;
  string(4) &quot;Gold&quot;
}
array(2) {
  [0]=&gt;
  string(1) &quot;X&quot;
  [1]=&gt;
  string(5) &quot;Mixed&quot;
}
array(2) {
  [0]=&gt;
  string(1) &quot;M&quot;
  [1]=&gt;
  string(3) &quot;Man&quot;
}
</pre></div>
   </div>
  </div>
 </div>


  <div class="refsect1 seealso" id="refsect1-function.cubrid-move-cursor-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
   <li class="member"><span class="function"><a href="cubrid_execute.html" class="function" rel="rdfs-seeAlso">cubrid_execute()</a> - Execute a prepared SQL statement</span></li>   
   </ul>
  </p>
  </div>

 
</div></div></div></body></html>